import { request } from '@umijs/max';

export async function post_save_api(Req: MemberApi.UserModelDto) {
  return request<ResponseApi.ResUnifyFormat<boolean>>('/admin/z_member/saveOrUpate', {
    method: 'POST',
    data: Req,
  });
}

export async function get_list_api(Req: MemberApi.UserSearch) {
  return request<ResponseApi.ResUnifyFormat<ResponseApi.List<MemberApi.UserList>>>(
    '/admin/z_member/findPage',
    {
      method: 'POST',
      data: Req,
    },
  );
}

export async function get_model_api(ID: string) {
  return request<ResponseApi.ResUnifyFormat<MemberApi.UserModel>>(
    `/admin/z_member/getDetails?id=${ID}`,
    {
      method: 'GET',
    },
  );
}
export async function delete_api(ID: string) {
  return request<ResponseApi.ResUnifyFormat<boolean>>(`/admin/z_member/delete?id=${ID}`, {
    method: 'GET',
  });
}

export async function delete_batch_api(IDs: (string | number)[]) {
  return request<ResponseApi.ResUnifyFormat<boolean>>('/admin/z_member/batchDelete', {
    method: 'POST',
    data: IDs,
  });
}
